package logic

import (
	"context"
	"video-guard/videorpc/videorpcclient"

	"video-guard/api/internal/svc"
	"video-guard/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type VideoTopicUserListLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewVideoTopicUserListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *VideoTopicUserListLogic {
	return &VideoTopicUserListLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *VideoTopicUserListLogic) VideoTopicUserList(req *types.VideoTopicUserListRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line

	list, err := l.svcCtx.VideoRpc.VideoTopicUserList(l.ctx, &videorpcclient.VideoTopicUserListRequest{
		TopicId:      req.Topicid,
		UploadUserId: req.Uploaduserid,
		Page:         req.Page,
		PageSize:     req.Pagesize,
	})
	if err != nil {
		return &types.Response{
			Message: err.Error(),
			Code:    500,
			Data:    nil,
		}, nil
	}

	return &types.Response{
		Message: "修改成功",
		Code:    200,
		Data:    list,
	}, nil
}
